
-- import Data.Array.ST
-- import Control.Monad.ST

import Data.Array.IArray
{-
mul xs ys = do 
                a <- newListArray ((1,1), (2,2)) xs :: ST s (STArray s (Int,Int) Int)
                b <- newListArray ((1,1), (2,2)) ys :: ST s (STArray s (Int,Int) Int)
                let column arr j = [readArray arr (i,j) | i <- [1,2]]
                let row arr i = [readArray arr (i,j) | j <- [1,2]]
                
                return (column a 2)
-}

l = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] :: [Double]
a = listArray ((1, 1), (5,5)) l :: Array (Int, Int) Double

type Matrix = Array (Int,Int) Double

column :: Matrix -> Int -> [Double]
column arr j = [arr ! (i, j) | i <- [start..finish]]
                where
                    start = fst $ fst $ bounds arr
                    finish = fst $ snd $ bounds arr

row :: Matrix -> Int -> [Double]
row arr i = [arr ! (i, j) | j <- [start..finish]]
                where
                    start = snd $ fst $ bounds arr
                    finish = snd $ snd $ bounds arr
{-
mul :: Array (Int, Int) Double -> Array (Int, Int) Double -> DiffArray (Int, Int) Int
mul xs ys =     let a = listArray ((1,1), (2,2)) xs :: DiffArray (Int,Int) Int
                    b = listArray ((1,1), (2,2)) ys :: DiffArray (Int,Int) Int
                    inner v u  = sum $ zipWith (*) v u
                in
                    array ((1,1), (2,2)) [((i,j),inner (row a i) (column b j)) | i <- [1,2], j <- [1,2]]
-}
